package org.dinner.order.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@NamedQueries ({
		@NamedQuery(name = "Menu.list", query="from Menu"),
		@NamedQuery(name = "Menu.getByDate", query = "from Menu m where m.date=:date")
})

@Table(name = "MENUS")
public class Menu {
	@Id
	@GeneratedValue
	private int id;
	@Column(nullable = false)
	private Date date;
	@ManyToMany
	@JoinTable(name = "MENU_DISHES")
	private List<Dish> dishes = new ArrayList<Dish>();
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public List<Dish> getDishes() {
		return dishes;
	}
	public void setDishes(List<Dish> dishes) {
		this.dishes = dishes;
	}
	
	

}
